import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home-G'
import Login from '../views/Login'
import Layout from '../components/Layout'

Vue.use(VueRouter)

// 新加 解决路由重复
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const routes = [
  {
    path: "/",
    name: "Layout",
    component: Layout,
    children: [
      //首页
      {
        path: '/',
        name: 'Home',
        component: Home,
        meta: {
          isLogin: true
        }
      },
      //选址
      {
        path: '/sitetesting',
        name: 'SiteTesting',
        component: () => import('../views/SiteTesting'),
        meta: {
          isLogin: true
        }
      },
      //商城
      {
        path: '/shopping',
        name: 'Shopping',
        component: () => import('../views/Shopping-Q'),
        meta: {
          isLogin: true
        }
      },
      //人才
      {
        path: '/talents',
        name: 'Talents',
        component: () => import('../views/Talents'),
        meta: {
          isLogin: true
        }
      },
      //我的
      {
        path: '/usmine',
        name: 'USmine',
        component: () => import('../views/USmine-L'),
        meta: {
          isLogin: true
        }
      },
    ]
  },
  //美甲资讯
  {
    path: '/manicure',
    name: 'HomeManicure',
    component: () => import('../views/Home-G/HomeManicure'),
    meta: {
      isLogin: true
    }
  },
  //店铺详情
  {
    path:'/stdetails',
    name:'StDetails',
    component: () => import('../views/SiteTesting/StDetails')
  },
  //商铺信息详情
  {
    path:'/storedetails/:id',
    name:'StoreDetails',
    component:() => import('../views/SiteTesting/StoreDetails')
  },
  //登录
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  //注册
  {
    path: '/register',
    name: 'Register',
    component: () => import('../views/Login/Register.vue')
  },
  //找回密码
  {
    path: '/usmine',
    name: 'Shopping',
    component: () => import('../views/USmine-L'),
  },
  // 我的全部订单
  {
    path: '/L-whole',
    name: 'L-whole',
    component: () => import('../views/USmine-L/L-whole.vue'),
    children: [
      {
        // 全部订单
        path: '/all',
        name: 'all',
        component: () => import('../views/USmine-L/L-Son/all.vue')
      },
     
      {
          //  待收货
        path: '/money'  ,
        name: 'money',
        component: () => import('../views/USmine-L/L-Son/money.vue')
      },
      {
        // 带支付
        path: '/pay',
        name: 'pay',
        component: () => import('../views/USmine-L/L-Son/pay.vue')
      },
      {
        // 评价
        path: '/good',
        name: 'good',
        component: () => import('../views/USmine-L/L-Son/good.vue')
      },
    
    ],
  },
  {
    path:"/LineItem",
    name:"LineItem",
    component:()=>import('../views/USmine-L/LineItem')
  },

  {   //个人资料
    path:'/material',
    name:'material',
    component:() =>import('../views/USmine-L/material.vue')

  },
  {  //账号管理
    path:'/account',
    name:'account',
    component:()=>import('../views/USmine-L/account.vue')

  },
  {  //设置
    path:'/set',
    name:'set',
    component:()=>import('../views/USmine-L/set.vue')
   
  },
   { //我的收藏
      path:'/Mycollect',
      name:'Mycollect',
      component:()=>import('../views/USmine-L/Mycollect.vue')
   },
   {  //我的订单
    path:'/MyOrder',
    name:'MyOrder',
    component:()=>import('../views/USmine-L/MyOrder.vue')

   },
    {   //浏览历史
      path:'/browse',
      name:'browse',
      component:()=>import('../views/USmine-L/browse.vue')
     
   },
   {   //常用地址
     path:'/site',
     name:'site',
     component:()=>import('../views/USmine-L/site.vue')
       
   },
   { //客服
      path:'/service',
      name:'service',
      component:()=>import('../views/USmine-L/service.vue')
   },
  {
    // 我的发布
    path:'/My-message',
    name:'My-message',
    component:()=>import('../views/USmine-L/My-message'),
    children:[
       {
        //  发布店铺
         path:'/ReleaseStore',
         name:'ReleaseStore',
         component:()=>import('../views/USmine-L/L-Son/ReleaseStore.vue')
       },
       {
        //  发布的需求
         path:'/demand',
         name:'demand',
         component:()=>import('../views/USmine-L/L-Son/demand.vue')
       }

    ]
  },
  // 意见反馈
  {
    path: '/feedback',
    name: 'feedback',
    component: () => import('../views/USmine-L/feedback.vue')
  },
  {
    path: '/forget',
    name: 'Forget',
    component: () => import('../views/Login/Forget.vue')
  },
  //城市
  {
    path: "/city/:cityname",
    name: "City",
    component: () => import('../components/City.vue'),
    meta: {
      isLogin: true
    }
  },
  //人才详情页
  {
    path:"/talentsdetails",
    name:"TalentsDetails",
    component:()=>import('../views/Talents/TalentsDetails.vue'),
    meta: {
      isLogin: true
    }
  },
  //活动页
  {
    path:"/activepage",
    name:"ActivePage",
    component:()=>import('../components/skip/ActivePage.vue'),
    meta: {
      isLogin: true
    }
  },
  //为你推荐详情页
  {
    path:"/recomdetails/:id",
    name:"RecomDetails",
    component:()=>import('../components/skip/RecomDetails.vue'),
    meta: {
      isLogin: true
    }
  },
  // 新加的商城子路由
  {
    path:'/listdetails/:obj',
    name:'ListDetails',
    component:()=>import('../views/Shopping-Q/components/details/ListDetails.vue')
  },
  //商城产品详情页
  {
    path:'/listGoodsDetails',
    name:'ListGoodsDetails',
    component:()=>import('../views/Shopping-Q/components/details/ListGoodsDetails.vue'),
    children:[
      {
        path:'/listGoodsDetails/goods/:obj',
        name:'Goods',
        component:()=>import('../views/Shopping-Q/components/details/Goods.vue'),
        
      },
      {
        path:'/listGoodsDetails/goodsDetails',
        name:'GoodsDetails',
        component:()=>import('../views/Shopping-Q/components/details/GoodsDetails.vue')
      }
    ]
  },
  // 规格选择
  {
    path:'/goodsDetailsLayout',
    name:'GoodsDetailsLayout',
    component:()=>import('../views/Shopping-Q/components/details/GoodsDetailsLayout.vue'),
    children:[
      {
        path:'/goodsDetailsLayout/color',
        name:'GoodsDetailsColor',
        component:()=>import('../views/Shopping-Q/components/details/GoodsDetailsColor.vue'),
      },
      {
        path:'/goodsDetailsLayout/colorNo',
        name:'GoodsDetailsColorNo',
        component:()=>import('../views/Shopping-Q/components/details/GoodsDetailsColorNo.vue'),
      }
    ]
  },
  // 用户评价界面
  {
    path:'/userEvaluation',
    name:'UserEvaluation',
    component:()=>import('../views/Shopping-Q/components/details/UserEvaluation.vue')
  },
  // 购物车界面
  {
    path:'/shoppingCar',
    name:'ShoppingCar',
    component:()=>import('../views/Shopping-Q/components/details/ShoppingCar.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
